package com.entity;

import java.util.List;

/** 
* @author Sunyelw yellowsunsna@foxmail.com 
* @version 创建时间：2018年1月7日 下午3:13:09 
* 类说明 
*/
public class Page<T> {
	//当前页的数据
	private List<T> data;
	//上一页
	private int prePage;
	//下一页
	private int nextPage;
	//每一页显示的记录数
	private int pageSize;
	//当前页
	private int currentPage;
	//总页面
	private int totalPages;
	//总记录数
	private int totalCount;
	public List<T> getData() {
		return data;
	}
	public void setData(List<T> data) {
		this.data = data;
	}
	public int getPrePage() {
		return prePage;
	}
	public void setPrePage(int prePage) {
		this.prePage = prePage;
	}
	public int getNextPage() {
		return this.getCurrentPage()==this.getTotalPages()?this.getTotalPages():this.getCurrentPage()+1;
	}
	public void setNextPage(int nextPage) {
		this.nextPage = nextPage;
	}
	public int getPageSize() {
		return pageSize;
	}
	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}
	public int getCurrentPage() {
		return currentPage;
	}
	public void setCurrentPage(int currentPage) {
		this.currentPage = currentPage;
	}
	public int getTotalPages() {
		return this.getTotalCount()%this.getPageSize()==0?
				this.getTotalCount()/this.getPageSize():this.getTotalCount()/this.getPageSize()+1;
	}
	public void setTotalPages(int totalPages) {
		this.totalPages = totalPages;
	}
	public int getTotalCount() {
		return totalCount;
	}
	public void setTotalCount(int totalCount) {
		this.totalCount = totalCount;
	}
	@Override
	public String toString() {
		return "Page [data=" + data + ", prePage=" + prePage + ", nextPage=" + nextPage + ", pageSize=" + pageSize
				+ ", currentPage=" + currentPage + ", totalPages=" + totalPages + ", totalCount=" + totalCount + "]";
	}
	
	
}